package com.x_memteor.base_master.base;

import com.google.gson.annotations.SerializedName;
import com.google.gson.internal.$Gson$Types;
import com.vise.xsnow.common.GsonUtil;
import com.x_memteor.base_master.utils.AesEncodeUtil;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author: X_Meteor
 * @description: 类描述
 * @version: V_1.0.0
 * @date: 2017/4/7 0007 13:58
 * @company:
 * @email: lx802315@163.com
 * {
 * state: 0失败，1成功
 * msg: 失败时返回的说明
 * data: 成功是返回的数据
 * }
 */
public class BaseEntity<T extends Object> {

    @SerializedName("state")
    private int state;
    @SerializedName("msg")
    private String msg;
    @SerializedName("data")
    private String data;

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    T dataBean;

    public T getDataBean(Class<T> cls) {
        data = AesEncodeUtil.decrypt(data);
        dataBean = GsonUtil.gson().fromJson(data, cls);
        return dataBean;
    }

}
